UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G1l88J04hy3sqzeFr2xHISarA+06gGqBGLbL0H5uns8='
WHERE
key_id = 'd2d18c89fa942bd8a93c185032ed948e2a5e8e7bd0d9e4e6493701e7076c64b1'
AND (
token = 'G1l88J04hy3sqzeFr2xHISarA+06gGqBGLbL0H5uns8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)