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