UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XoEcd7Nqm9/6jJezTJg4fHqfi9RlBtgYxvPGwWWeMfo=' 
WHERE 
  key_id = '79a79fbfaac2dcf5a9ecce1c7a6c9989572014b68fea6eba313904e801b4b50a' 
  AND (
    token = 'XoEcd7Nqm9/6jJezTJg4fHqfi9RlBtgYxvPGwWWeMfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033