UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b39y0lXHEiN7K2qKaq6qY83F3OCg5QW00DULkzniPhY=' 
WHERE 
  key_id = '3fa891e5831accf6d4def355fc59435e631d223bf1d05d667f29052f07d5f7e8' 
  AND (
    token = 'b39y0lXHEiN7K2qKaq6qY83F3OCg5QW00DULkzniPhY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044