UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v4ODu8HdwThjcZ1WYxqMjEQCq4RRxkUYQ30zpwaU1Sc=' 
WHERE 
  key_id = '26f3743a70af89184047524024e10b9500d14da19e118e2adf22a1cd7acb5431' 
  AND (
    token = 'v4ODu8HdwThjcZ1WYxqMjEQCq4RRxkUYQ30zpwaU1Sc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025