UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3MHQMAhq1tWPt2Z/15GjlpOT6bd1UYnDVkiTVpEvIo4='
WHERE
key_id = 'b581df99ab9c0472362ff17ad582bfe3675d7ef1d638e61c3750a887a5eb5eab'
AND (
token = '3MHQMAhq1tWPt2Z/15GjlpOT6bd1UYnDVkiTVpEvIo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)