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

Query time 0.00028