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