UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rRPhWpQKvUn3DMtRjA5IwOLowGrsZ/eR9EHj0ChonUg='
WHERE
key_id = 'd694af8490ab10ade8754248eee12e9109a1eca412f6d3912a52b88a8c0b15cc'
AND (
token = 'rRPhWpQKvUn3DMtRjA5IwOLowGrsZ/eR9EHj0ChonUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)