UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LErlgz9zu9I8pnUmgfS4Tf/xqn7urk/dY8vK68yOI6U='
WHERE
key_id = '3b248a812777fe8befcdc649580e490f6cf10133b6a282e52fa8310516234a0b'
AND (
token = 'LErlgz9zu9I8pnUmgfS4Tf/xqn7urk/dY8vK68yOI6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)