UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WKydJfosQrBsWtJgaHT1rExwSAnCYU0taJBib1aWCW0=' 
WHERE 
  key_id = '3551b695479809eace8a35ba9f2f075dab0fa1746adf5b0739fca5fe58a8c0bb' 
  AND (
    token = 'WKydJfosQrBsWtJgaHT1rExwSAnCYU0taJBib1aWCW0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024