UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JhMm+UNMjzbex7ohgfwYKWGEThKTQi+dv5t+X3X1VtA=' 
WHERE 
  key_id = '76b134cf17afa6a2e2a1e1fc430672f97603ac97e2c3b11f3c672e3f975d7611' 
  AND (
    token = 'JhMm+UNMjzbex7ohgfwYKWGEThKTQi+dv5t+X3X1VtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047