UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I8/36thR/vIoslV7iY8JdErya833Wiuyu2uPnXRyPKQ=' 
WHERE 
  key_id = '0d22a1df13aec64e33f7b552d28d9b01a73cbca109c97438e345e1b487676643' 
  AND (
    token = 'I8/36thR/vIoslV7iY8JdErya833Wiuyu2uPnXRyPKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029