UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5lFEdarMiQIz5uBx2JZK7548vwqPInX1655NRZUwIWM='
WHERE
key_id = '6cf0a9c4313886b7601df6e3d5944ba5cece0ab46f1a1bfe43dec8e72fe504de'
AND (
token = '5lFEdarMiQIz5uBx2JZK7548vwqPInX1655NRZUwIWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)