UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fuAC3nKms3WtOfFvU+4QkU2k43h1XM1nOseevsdwUz4=' 
WHERE 
  key_id = 'ab468cb70a7df1ddcd34cf763197b186f20867ed7eb7203d40b597f65083a60d' 
  AND (
    token = 'fuAC3nKms3WtOfFvU+4QkU2k43h1XM1nOseevsdwUz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019