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