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