UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hTFrNA1b1/kU2XfLOsakVRljl378qjkcfy4T7EKrvq4='
WHERE
key_id = 'bcc647f03dd22b0046cd520d3bc96a2db2ba5045e7acf2a00437b909112cd8ff'
AND (
token = 'hTFrNA1b1/kU2XfLOsakVRljl378qjkcfy4T7EKrvq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)