UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ijRkV0og2Fb2sFfxvORMyLd5vRA+pIOIovTqJM06oHg=' 
WHERE 
  key_id = '37c64ce6ca3ed23309539b3cf865b32a411dd884b35fed007a5d50e30e811432' 
  AND (
    token = 'ijRkV0og2Fb2sFfxvORMyLd5vRA+pIOIovTqJM06oHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045