UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'blRyWg6gwQ22zFPLmKA9p8ke2A2yie4A08DtUU2gMu8='
WHERE
key_id = 'b6b71f6357655e360f25be7c3fc838a2d9d769a0ab99c0060f091f0ed27f2061'
AND (
token = 'blRyWg6gwQ22zFPLmKA9p8ke2A2yie4A08DtUU2gMu8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)