UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gkr+TqhTQ7ETbZ36a0eg84J/ru/R7Qz+pu69042PNI8='
WHERE
key_id = '43be065e86fcc639cc0565547bf21838cfae41131287ee98a7a5f7f22808a7cd'
AND (
token = 'Gkr+TqhTQ7ETbZ36a0eg84J/ru/R7Qz+pu69042PNI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)