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