UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oY/6OHkt/eLrd52jZB3Unqp44GIrvP4P9u9t9bIf6Q0=' 
WHERE 
  key_id = '4ab31c641d402f4403b21e145f82f2c24f8b9c13edf1ec32ae6569d3290530a6' 
  AND (
    token = 'oY/6OHkt/eLrd52jZB3Unqp44GIrvP4P9u9t9bIf6Q0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032