UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0FenhIo3wbHKBAGlStknFOaMhnEAJXFU6sdaJb8CiVk='
WHERE
key_id = '9e0921271af22e182908952d0f2cb7702e0c86d544b95f94f067f877ca28bfd1'
AND (
token = '0FenhIo3wbHKBAGlStknFOaMhnEAJXFU6sdaJb8CiVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)