UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rCwOejseHBc87cEdsJIWDuGWIKrgn2w94pzJNx2w8iQ='
WHERE
key_id = 'bb621db1a906bf3cb4de63924d3a4bffda4e6d419039dc780881c2592f5ac440'
AND (
token = 'rCwOejseHBc87cEdsJIWDuGWIKrgn2w94pzJNx2w8iQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)