UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VdKr0q2iDiCMI/FBjtq0qOyvtqWoYAAD5a1GKRHDNDE=' 
WHERE 
  key_id = '1b5d66838ab81ba5700c8daa884ee3408f048667a0e58d9c76de33af57071a62' 
  AND (
    token = 'VdKr0q2iDiCMI/FBjtq0qOyvtqWoYAAD5a1GKRHDNDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030