UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cpsk3vt1Q8yD+5v6Tt2AtWdGrRN1ZpeRWKYBIvtqDjg='
WHERE
key_id = '6835c8c1c94864b5ba0cc4bc4a719159c04c4c15182ee3e0012973c3814eda7a'
AND (
token = 'Cpsk3vt1Q8yD+5v6Tt2AtWdGrRN1ZpeRWKYBIvtqDjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)