UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tKhuJVbQPYTLj9wO8k++YV1nv1vKpem2iyZtgez4W7U='
WHERE
key_id = '14f9671aff62c72d3750d1fdcb74fcb6b09e92e152995c786ea0a1503417779a'
AND (
token = 'tKhuJVbQPYTLj9wO8k++YV1nv1vKpem2iyZtgez4W7U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)